//////////////////////////////////////////////////////////////////////////
#pragma once
#pragma managed
//////////////////////////////////////////////////////////////////////////
NAMESPACE_BEGIN
//////////////////////////////////////////////////////////////////////////
public ref class ManagedContourScanner : public NativeHandleObject
{
protected:
	virtual void ReleaseHandle() override
	{
		CvContourScanner scanner = this->ToCvContourScanner();
		cvEndFindContours(&scanner);
		m_pHandle = scanner;
	}

internal:
	ManagedContourScanner(CvContourScanner handle, bool own) : NativeHandleObject(handle, own)
	{
	}

	inline CvContourScanner ToCvContourScanner()
	{
		return (CvContourScanner)m_pHandle;
	}
};

public ref class ManagedConnectedComp : public NativeHandleObject
{
public:
	ManagedConnectedComp() : NativeHandleObject(new CvConnectedComp(), true)
	{
	}

protected:
	virtual void ReleaseHandle() override
	{
		delete m_pHandle;
	}

internal:
	inline CvConnectedComp* ToConnectedCompPointer()
	{
		return (CvConnectedComp*)m_pHandle;
	}
};

public ref class ManagedChainPtReader : public NativeHandleObject
{
public:
	ManagedChainPtReader() : NativeHandleObject(new CvChainPtReader(), true)
	{
	}

protected:
	virtual void ReleaseHandle() override
	{
		delete m_pHandle;
	}

internal:
	inline CvChainPtReader* ToChainPtReaderPointer()
	{
		return (CvChainPtReader*)m_pHandle;
	}
};

public ref class ManagedContourTree : public NativeHandleObject
{
protected:
	virtual void ReleaseHandle() override
	{
	}

internal:
	ManagedContourTree(CvContourTree* handle) : NativeHandleObject(handle, false)
	{
	}

	inline CvContourTree* ToContourTreePointer()
	{
		return (CvContourTree*)m_pHandle;
	}
};

public ref class ManagedConvexityDefect : public NativeHandleObject
{
protected:
	virtual void ReleaseHandle() override
	{
	}

internal:
	ManagedConvexityDefect(CvConvexityDefect* handle, bool own) : NativeHandleObject(handle, own)
	{
	}

	inline CvConvexityDefect* ToConvexityDefectPointer()
	{
		return (CvConvexityDefect*)m_pHandle;
	}
};

public ref class ManagedQuadEdge2D : public NativeHandleObject
{
protected:
	virtual void ReleaseHandle() override
	{
	}

internal:
	ManagedQuadEdge2D(CvQuadEdge2D* handle, bool own) : NativeHandleObject(handle, own)
	{
	}

	inline CvQuadEdge2D* ToQuadEdge2DPointer()
	{
		return (CvQuadEdge2D*)m_pHandle;
	}
};

public ref class ManagedSubdiv2D : public NativeHandleObject
{
protected:
	virtual void ReleaseHandle() override
	{
	}

internal:
	ManagedSubdiv2D(CvSubdiv2D* handle) : NativeHandleObject(handle, false)
	{
	}

	inline CvSubdiv2D* ToCvSubdiv2DPointer()
	{
		return (CvSubdiv2D*)m_pHandle;
	}
};

public ref class ManagedConDensation : public NativeHandleObject
{
protected:
	virtual void ReleaseHandle() override
	{
		CvConDensation* pConDensation = this->ToConDensationPointer();
		cvReleaseConDensation(&pConDensation);
		m_pHandle = pConDensation;
	}

internal:
	ManagedConDensation(CvConDensation* handle, bool own) : NativeHandleObject(handle, own)
	{
	}

	inline CvConDensation* ToConDensationPointer()
	{
		return (CvConDensation*)m_pHandle;
	}
};

public ref class ManagedKalman : public NativeHandleObject
{
protected:
	virtual void ReleaseHandle() override
	{
		CvKalman* pKalman = this->ToKalmanPointer();
		cvReleaseKalman(&pKalman);
		m_pHandle = pKalman;
	}

internal:
	ManagedKalman(CvKalman* handle, bool own) : NativeHandleObject(handle, own)
	{
	}

	inline CvKalman* ToKalmanPointer()
	{
		return (CvKalman*)m_pHandle;
	}
};

public ref class ManagedHaarClassifier : public NativeHandleObject
{
protected:
	virtual void ReleaseHandle() override
	{
	}

internal:
	ManagedHaarClassifier(CvHaarClassifier* handle, bool own) : NativeHandleObject(handle, own)
	{
	}

	inline CvHaarClassifier* ToHaarClassifierPointer()
	{
		return (CvHaarClassifier*)m_pHandle;
	}
};

public ref class ManagedHaarStageClassifier : public NativeHandleObject
{
protected:
	virtual void ReleaseHandle() override
	{
	}

internal:
	ManagedHaarStageClassifier(CvHaarStageClassifier* handle, bool own) : NativeHandleObject(handle, own)
	{
	}

	inline CvHaarStageClassifier* ToHaarStageClassifierPointer()
	{
		return (CvHaarStageClassifier*)m_pHandle;
	}
};

public ref class ManagedHidHaarClassifierCascade : public NativeHandleObject
{
protected:
	virtual void ReleaseHandle() override
	{
	}

internal:
	ManagedHidHaarClassifierCascade(CvHidHaarClassifierCascade* handle, bool own) : NativeHandleObject(handle, own)
	{
	}

	inline CvHidHaarClassifierCascade* ToHidHaarClassifierCascadePointer()
	{
		return (CvHidHaarClassifierCascade*)m_pHandle;
	}
};

public ref class ManagedHaarClassifierCascade : public NativeHandleObject
{
protected:
	virtual void ReleaseHandle() override
	{
		CvHaarClassifierCascade* pHaarClassifierCascade = this->ToCvHaarClassifierCascadePointer();
		cvReleaseHaarClassifierCascade(&pHaarClassifierCascade);
		m_pHandle = pHaarClassifierCascade;
	}

internal:
	ManagedHaarClassifierCascade(CvHaarClassifierCascade* handle, bool own) : NativeHandleObject(handle, own)
	{
	}

	inline CvHaarClassifierCascade* ToCvHaarClassifierCascadePointer()
	{
		return (CvHaarClassifierCascade*)m_pHandle;
	}
};

public ref class ManagedFeatureTree : public NativeHandleObject
{

protected:
	virtual void ReleaseHandle() override
	{
		CvFeatureTree* pFeatureTree = this->ToCvFeatureTreePointer();
		cvReleaseFeatureTree(pFeatureTree);
		m_pHandle = pFeatureTree;
	}

internal:
	ManagedFeatureTree(CvFeatureTree* handle, bool own) : NativeHandleObject(handle, own)
	{
	}

	inline CvFeatureTree* ToCvFeatureTreePointer()
	{
		return (CvFeatureTree*)m_pHandle;
	}
};

/////////////////////////////////////////////////////////////////////////
NAMESPACE_END
//////////////////////////////////////////////////////////////////////////